package com.qingcheng.controller.comment;

import com.alibaba.dubbo.config.annotation.Reference;
import com.qingcheng.entity.PageResult;
import com.qingcheng.entity.Result;
import com.qingcheng.pojo.comment.CommentLog;
import com.qingcheng.service.comment.CommentLogService;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@RestController
@RequestMapping("/commentLog")
public class CommentLogControllerht {

    @Reference
    private CommentLogService commentLogService;

    @GetMapping("/findAll")
    public List<CommentLog> findAll(){
        return commentLogService.findAll();
    }

    @GetMapping("/findPage")
    public PageResult<CommentLog> findPage(int page, int size){
        return commentLogService.findPage(page, size);
    }

    @PostMapping("/findList")
    public List<CommentLog> findList(@RequestBody Map<String,Object> searchMap){
        return commentLogService.findList(searchMap);
    }

    @PostMapping("/findPage")
    public PageResult<CommentLog> findPage(@RequestBody Map<String,Object> searchMap,int page, int size){
        return  commentLogService.findPage(searchMap,page,size);
    }

    @GetMapping("/findById")
    public CommentLog findById(String id){
        return commentLogService.findById(id);
    }


    @PostMapping("/add")
    public Result add(@RequestBody CommentLog commentLog){
        commentLogService.add(commentLog);
        return new Result();
    }

    @PostMapping("/update")
    public Result update(@RequestBody CommentLog commentLog){
        commentLogService.update(commentLog);
        return new Result();
    }

    @GetMapping("/delete")
    public Result delete(String id){
        commentLogService.delete(id);
        return new Result();
    }

}
